/*抄送人*/

import { useForm } from "../../../framework/common/context/metadata-context";
import { Input,Select} from 'antd';
import eventBus from "../../../framework/common/eventBus";

import SelectAuditors from "../../../RuntimeForm/SelectAuditors/SelectAuditors";

const { TextArea } = Input;
const { Option } = Select;

//审批同意表单
export default function({
    approveType,
    onChange,
    setFormData,
    value = [],
    placeholder="请选择抄送人",
    form,
}){
    const metadataManager = useForm().root
    const { data: tplData, urlPrefix, params, getErrors} = metadataManager;
    
    //新表单reloadForm后抄送人重新设置数据//todo
    // $(window).on("reloadForm", function () {
    //     tplData.components.selectAuditors.reloadData();
    // });

    return <SelectAuditors
              value={value}
              CurUserGUID={tplData.CurUserGUID} 
              package_id={tplData.package_id}
              CurUserDepartmentGUID={tplData.CurUserDepartmentGUID} 
              urlPrefix={urlPrefix} 
              placeholder={placeholder}
              onChange={(data)=>{
                eventBus.publish("approveFormCommonData.update",{
                  step_cc_list: data
                });//把当前字段的值，更新到公共缓存内
                onChange(data);
              }}
              title={"抄送人"}
          ></SelectAuditors>
}